import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_echart/flutter_echart.dart';

/// 创建人： Created by zhaolong
/// 创建时间：Created by  on 2020/12/21.
///
/// 可关注公众号：我的大前端生涯   获取最新技术分享
/// 可关注网易云课堂：https://study.163.com/instructor/1021406098.htm
/// 可关注博客：https://blog.csdn.net/zl18603543572
///
/// 代码清单
///代码清单
class MineItem3Page extends StatefulWidget {
  @override
  _MineItem3PageState createState() => _MineItem3PageState();
}

class _MineItem3PageState extends State<MineItem3Page> {
  List<EChartPieBean> _dataList = [
    EChartPieBean(title: "每日一题", number: 200, color: Colors.lightBlueAccent),
    EChartPieBean(title: "快速练习", number: 200, color: Colors.deepOrangeAccent),
    EChartPieBean(title: "新闻阅读", number: 400, color: Colors.green),
    EChartPieBean(title: "党建", number: 300, color: Colors.amber),
  ];

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      width: double.infinity,
      height: double.infinity,
      child: Column(
        children: [
          Container(
            padding: EdgeInsets.only(left: 12, right: 12, top: 20),
            child: Row(
              children: [
                Container(
                  width: 2,
                  height: 24,
                  color: Colors.green,
                ),
                SizedBox(
                  width: 16,
                ),
                Text(
                  "我的时间参与分布",
                  style: TextStyle(fontWeight: FontWeight.w500, fontSize: 18),
                )
              ],
            ),
          ),
          Container(
            padding: EdgeInsets.only(bottom: 20, top: 16),
            height: 240,
            child: PieChatWidget(
              dataList: _dataList,
              //是否输出日志
              isLog: true,
              //是否需要背景
              isBackground: true,
              //是否画直线
              isLineText: true,
              //背景
              bgColor: Colors.white,
              //是否显示最前面的内容
              isFrontgText: true,
              //默认选择放大的块
              initSelect: 1,
              //初次显示以动画方式展开
              openType: OpenType.ANI,
              //旋转类型
              loopType: LoopType.DOWN_LOOP,
              //点击回调
              clickCallBack: (int value) {
                print("当前点击显示 $value");
              },
            ),
          ),
        ],
      ),
    );
  }
}
